/**
 * @author caiqian
 * @Company Mtic
 * @date 2021/9/1
 */

import java.util.ArrayList;
import java.util.List;

/**
 * 人民日报
 *
 * @author caiqian
 */
public class PeopleNewsPaper implements INewsPaper {

    /**
     * 订阅者的列表
     */
    private final List<ISubScribe> subList = new ArrayList<ISubScribe>();


    /**
     * 添加订阅者
     *
     * @param mSubScribe
     */
    @Override
    public void addSubscriber(ISubScribe mSubScribe) {
        subList.add(mSubScribe);
    }

    /**
     * 移除订阅者
     *
     * @param mSubScribe
     */
    @Override
    public void removeSubScriber(ISubScribe mSubScribe) {
        subList.remove(mSubScribe);
    }

    /**
     * 发报纸啦~~
     */
    @Override
    public void sendNewsPaper() {
        for (ISubScribe aSub : subList) {
            //订阅者有报纸啦
            aSub.hasNewPaper();
        }

    }
}
